import 'package:flutter/material.dart';
import 'package:flutter_demo/demo/i18n/map/languageLocalizations.dart';

//main.dart 设置多语言
//ios info.plist 新加 Localizations 设置中文 英文

class I18nDemo extends StatelessWidget {
  const I18nDemo({super.key});

  @override
  Widget build(BuildContext context) {
    Locale locale = Localizations.localeOf(context);

    return Scaffold(
        appBar: AppBar(
          title: Text('I18nDemo'),
          elevation: 0.0,
        ),
        body: Center(
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              Text(
                locale.toString(),
              ),
              Text(
                LanguageLocalizations.of(context).title,
                style: Theme.of(context).textTheme.titleMedium,
              )
            ],
          ),
        ));
  }
}
